package com.glamour.hlcity.module.node.filter;

import org.htmlparser.Node;
import org.htmlparser.NodeFilter;

/**
 * 标签的前字符串过滤
 * 
 * @author zhaoxing.liuzx
 * 
 */
public class TagFirstTextFilter implements NodeFilter {
	private static final long serialVersionUID = 7438384065244618726L;
	private String firstText;

	public String getFirstText() {
		return firstText;
	}

	public void setFirstText(String firstText) {
		this.firstText = firstText;
	}
	

	public TagFirstTextFilter(String firstText) {
		super();
		this.firstText = firstText;
	}

	@Override
	public boolean accept(Node node) {
		
		if (node.getText().toLowerCase().startsWith(getFirstText())) {
			return true;
		} else {
			return false;
		}
	}
}
